home *** CD-ROM | disk | FTP | other *** search
- /*
- File: BestFitH.h
-
- Contains: BestFitHeap class interface
-
- Owned by: Michael Burbidge
- Owned by: Jens Alfke
-
- Copyright: © 1993-4 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <10> 5/4/95 jpa Support for finding largest free block
- [1235657] and validating memory ranges
- [1246077]
- <9> 1/25/95 jpa Removed five-$ comments [1210981]
- <8> 10/24/94 jpa Constness [1194286]
- <7> 9/29/94 RA 1189812: Mods for 68K build.
- <6> 9/14/94 jpa Eliminated dependencies on rest of OpenDoc.
- Added support for getting the heap of a
- block by stuffing heap ptr in busy block
- header. [1186692]
- <5> 8/17/94 jpa (Oops, deleted obsolete "in progress" msg)
- <4> 8/17/94 jpa Implemented huge-block support [1179565],
- segment disposal [1181509] and the
- SOM-block flag [1181510].
- <3> 8/8/94 jpa Added fHugeBlockSize -- not used yet
- [1179565]
- <2> 6/10/94 MB Make it build
- <1> 6/9/94 MB first checked in
- <4> 5/27/94 MB #1162181: Fixed MMM integration bug
- <2> 5/9/94 MB #1162181: Changes necessary to install MMM.
- <1> 4/29/94 MB first checked in
- To Do:
- In Progress:
- */
-
- #ifndef _BESTFITH_
- #define _BESTFITH_
-
- #ifndef _MEMORYHE_
- #include "MemoryHe.h"
- #endif
-
-
- //========================================================================================
- // Forward class declarations
- //========================================================================================
-
- class PrivBestFitBlock;
- class BestFitHeap;
-
-
- //========================================================================================
- // STRUCT PrivBestFitBlockFreeListLinks
- //
- // The following fields are only present in free blocks. They are used to link the free
- // block into the free block tree. The address of a free block is also stored at the end
- // of the block and must be accounted for in the minimum block size.
- //========================================================================================
-
- struct PrivBestFitBlockFreeListLinks
- {
- PrivBestFitBlock* fParent;
- PrivBestFitBlock* fLeft;
- PrivBestFitBlock* fRight;
- };
-
-
- //========================================================================================
- // STRUCT PrivBestFitBlockHeader
- //========================================================================================
-
- // The fBits field of PrivBestFitBlockHeader contains five fields. The following masks are
- // used to get and set the fields. The block type field is used to distinguish best fit
- // blocks from chunky blocks and must be the first four bits of the last byte in fBits.
-
- #ifdef MM_LITTLE_ENDIAN
- // Bytes are in reverse order in a long.
-
- const unsigned long BestFitBlockHeader_kSizeMask = 0x00FFFFFF;
- const unsigned long BestFitBlockHeader_kSizeShift = 0;
-
- const unsigned long BestFitBlockHeader_kBlockTypeMask = 0xC0000000;
- const unsigned long BestFitBlockHeader_kBlockTypeShift = 30;
-
- const unsigned long BestFitBlockHeader_kIsObjectMask = 0x20000000; //jpa
- const unsigned long BestFitBlockHeader_kIsObjectShift = 29;
-
- const unsigned long BestFitBlockHeader_kFirstBlockMask = 0x10000000; //jpa
- const unsigned long BestFitBlockHeader_kFirstBlockShift = 28;
-
- const unsigned long BestFitBlockHeader_kBusyMask = 0x08000000;
- const unsigned long BestFitBlockHeader_kBusyShift = 27;
-
- const unsigned long BestFitBlockHeader_kPreviousBusyMask = 0x04000000;
- const unsigned long BestFitBlockHeader_kPreviousBusyShift = 26;
-
- const unsigned long BestFitBlockHeader_kMagicNumberMask = 0x03000000;
- const unsigned long BestFitBlockHeader_kMagicNumberShift = 24;
- #else
- const unsigned long BestFitBlockHeader_kSizeMask = 0xFFFFFF00;
- const unsigned long BestFitBlockHeader_kSizeShift = 8;
-
- const unsigned long BestFitBlockHeader_kBlockTypeMask = 0x000000C0;
- const unsigned long BestFitBlockHeader_kBlockTypeShift = 6;
-
- const unsigned long BestFitBlockHeader_kIsObjectMask = 0x00000020; //jpa
- const unsigned long BestFitBlockHeader_kIsObjectShift = 5;
-
- const unsigned long BestFitBlockHeader_kFirstBlockMask = 0x00000010; //jpa
- const unsigned long BestFitBlockHeader_kFirstBlockShift = 4;
-
- const unsigned long BestFitBlockHeader_kBusyMask = 0x00000008;
- const unsigned long BestFitBlockHeader_kBusyShift = 3;
-
- const unsigned long BestFitBlockHeader_kPreviousBusyMask = 0x00000004;
- const unsigned long BestFitBlockHeader_kPreviousBusyShift = 2;
-
- const unsigned long BestFitBlockHeader_kMagicNumberMask = 0x00000003;
- const unsigned long BestFitBlockHeader_kMagicNumberShift = 0;
- #endif
-
- struct PrivBestFitBlockHeader
- {
- unsigned long fBits;
- union{
- BestFitHeap* fHeap; //jpa: Added ptr back to heap 9/10/94
- PrivBestFitBlockFreeListLinks fFreeLinks;
- };
- };
-
-
- //========================================================================================
- // CLASS PrivBestFitBlock
- //========================================================================================
-
- #ifdef BUILD_WIN16
- const ODBlockSize BestFitBlock_kMaxBlockSize = 60L * 1024L;
- // Block size limited by 64K limit of far pointers. Allow 4K for overhead in the
- // various layers.
- #else
- const ODBlockSize BestFitBlock_kMaxBlockSize = 0x00FFFFFF;
- #endif
-
- class PrivBestFitBlock
- {
- public:
-
- enum
- {
- kBusyOverhead = sizeof(unsigned long) + sizeof(BestFitHeap*), //jpa added heap overhead 9/10/94
- kMinBlockSize = sizeof(PrivBestFitBlockHeader) + sizeof(void *),
- kBlockTypeId = MemoryHeap::kBlockTypeId + 1,
- kMagicNumber = 0x3
- };
-
-
- Boolean operator>(const PrivBestFitBlock& blk) const;
- Boolean operator<(const PrivBestFitBlock& blk) const;
- Boolean operator>=(const PrivBestFitBlock& blk) const;
- Boolean operator<=(const PrivBestFitBlock& blk) const;
- Boolean operator==(const PrivBestFitBlock& blk) const;
- Boolean operator!=(const PrivBestFitBlock& blk) const;
- PrivBestFitBlock& operator=(const PrivBestFitBlock& blk);
-
- inline void operator delete(void *) { };
- void* operator new(SIZE_T, void* ptr);
- void* operator new(SIZE_T);
-
- PrivBestFitBlock(int busy,
- int prevBusy,
- long size);
- PrivBestFitBlock(const PrivBestFitBlock& otherBlock);
-
- BestFitHeap* GetHeap() const; //jpa 9/10/94
- Boolean GetBusy() const;
- Boolean GetIsFirst() const; //jpa
- Boolean GetIsObject() const; //jpa
- PrivBestFitBlock* GetLeft() const;
- unsigned int GetMagicNumber() const;
- PrivBestFitBlock* GetNext() const;
- PrivBestFitBlock* GetParent() const;
- Boolean GetPreviousBusy() const;
- PrivBestFitBlock* GetRight() const;
- ODBlockSize GetSize() const;
- unsigned short GetBlockType() const;
-
- void SetHeap(BestFitHeap*); //jpa 9/10/94
- void SetBusy(Boolean busy);
- void SetIsFirst(Boolean first); //jpa
- void SetIsObject(Boolean isObj); //jpa
- void SetLeft(PrivBestFitBlock* left);
- void SetNext(PrivBestFitBlock* fNext);
- void SetParent(PrivBestFitBlock* parent);
- void SetPrevBusy(Boolean busy);
- void SetRight(PrivBestFitBlock* right);
- void SetSize(ODBlockSize size);
- void SetBlockType(unsigned long blockType);
- void SetMagicNumber(unsigned long magicNumber);
-
- void StuffAddressAtEnd();
-
- protected:
-
- private:
- PrivBestFitBlockHeader fHeader;
- };
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::operator delete
- //----------------------------------------------------------------------------------------
- /*
- inline void PrivBestFitBlock::operator delete(void*)
- {
- }
- */
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::operator new
- //----------------------------------------------------------------------------------------
-
- inline void* PrivBestFitBlock::operator new(SIZE_T, void* ptr)
- {
- return ptr;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::operator new
- //----------------------------------------------------------------------------------------
-
- inline void* PrivBestFitBlock::operator new(SIZE_T)
- {
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::operator>=
- //----------------------------------------------------------------------------------------
-
- inline Boolean PrivBestFitBlock::operator>=(const PrivBestFitBlock& blk) const
- {
- return *this > blk || *this == blk;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::operator<=
- //----------------------------------------------------------------------------------------
-
- inline Boolean PrivBestFitBlock::operator<=(const PrivBestFitBlock& blk) const
- {
- return *this < blk || *this == blk;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::operator!=
- //----------------------------------------------------------------------------------------
-
- inline Boolean PrivBestFitBlock::operator!=(const PrivBestFitBlock& blk) const
- {
- return !(*this == blk);
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::operator=
- //----------------------------------------------------------------------------------------
-
- inline PrivBestFitBlock& PrivBestFitBlock::operator=(const PrivBestFitBlock& blk)
- {
- fHeader = blk.fHeader;
- return (*this);
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::PrivBestFitBlock
- //----------------------------------------------------------------------------------------
-
- inline PrivBestFitBlock::PrivBestFitBlock(const PrivBestFitBlock& blk) :
- fHeader(blk.fHeader)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetBusy
- //----------------------------------------------------------------------------------------
-
- inline Boolean PrivBestFitBlock::GetBusy() const
- {
- return (fHeader.fBits & BestFitBlockHeader_kBusyMask) != 0 ? true : false;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetIsFirst
- //----------------------------------------------------------------------------------------
-
- inline Boolean PrivBestFitBlock::GetIsFirst() const
- {
- return (fHeader.fBits & BestFitBlockHeader_kFirstBlockMask) != 0 ? true : false;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetIsObject
- //----------------------------------------------------------------------------------------
-
- inline Boolean PrivBestFitBlock::GetIsObject() const
- {
- return (fHeader.fBits & BestFitBlockHeader_kIsObjectMask) != 0 ? true : false;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetLeft
- //----------------------------------------------------------------------------------------
-
- inline PrivBestFitBlock* PrivBestFitBlock::GetLeft() const
- {
- return fHeader.fFreeLinks.fLeft;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetMagicNumber
- //----------------------------------------------------------------------------------------
-
- inline unsigned int PrivBestFitBlock::GetMagicNumber() const
- {
- return (fHeader.fBits & BestFitBlockHeader_kMagicNumberMask)
- >> BestFitBlockHeader_kMagicNumberShift;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetNext
- //----------------------------------------------------------------------------------------
-
- inline PrivBestFitBlock* PrivBestFitBlock::GetNext() const
- {
- return fHeader.fFreeLinks.fParent;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetParent
- //----------------------------------------------------------------------------------------
-
- inline PrivBestFitBlock* PrivBestFitBlock::GetParent() const
- {
- return fHeader.fFreeLinks.fParent;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetPreviousBusy
- //----------------------------------------------------------------------------------------
-
- inline Boolean PrivBestFitBlock::GetPreviousBusy() const
- {
- return (fHeader.fBits & BestFitBlockHeader_kPreviousBusyMask) != 0 ? true : false;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetRight
- //----------------------------------------------------------------------------------------
-
- inline PrivBestFitBlock* PrivBestFitBlock::GetRight() const
- {
- return fHeader.fFreeLinks.fRight;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetSize
- //----------------------------------------------------------------------------------------
-
- inline ODBlockSize PrivBestFitBlock::GetSize() const
- {
- return (fHeader.fBits & BestFitBlockHeader_kSizeMask)
- >> BestFitBlockHeader_kSizeShift;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetBlockType
- //----------------------------------------------------------------------------------------
-
- inline unsigned short PrivBestFitBlock::GetBlockType() const
- {
- return (fHeader.fBits & BestFitBlockHeader_kBlockTypeMask)
- >> BestFitBlockHeader_kBlockTypeShift;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetBusy
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetBusy(Boolean busy)
- {
- if (busy)
- fHeader.fBits |= BestFitBlockHeader_kBusyMask;
- else
- fHeader.fBits &= ~BestFitBlockHeader_kBusyMask;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetIsFirst
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetIsFirst(Boolean first)
- {
- if (first)
- fHeader.fBits |= BestFitBlockHeader_kFirstBlockMask;
- else
- fHeader.fBits &= ~BestFitBlockHeader_kFirstBlockMask;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetIsObject
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetIsObject(Boolean isObj)
- {
- if (isObj)
- fHeader.fBits |= BestFitBlockHeader_kIsObjectMask;
- else
- fHeader.fBits &= ~BestFitBlockHeader_kIsObjectMask;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetLeft
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetLeft(PrivBestFitBlock* left)
- {
- fHeader.fFreeLinks.fLeft = left;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetNext
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetNext(PrivBestFitBlock* fNext)
- {
- // The fParent field is used both for a parent and a next pointer on different
- // occasions.
-
- fHeader.fFreeLinks.fParent = fNext;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetParent
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetParent(PrivBestFitBlock* parent)
- {
- fHeader.fFreeLinks.fParent = parent;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetPrevBusy
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetPrevBusy(Boolean busy)
- {
- if (busy)
- fHeader.fBits |= BestFitBlockHeader_kPreviousBusyMask;
- else
- fHeader.fBits &= ~BestFitBlockHeader_kPreviousBusyMask;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetRight
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetRight(PrivBestFitBlock* right)
- {
- fHeader.fFreeLinks.fRight = right;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetSize
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetSize(ODBlockSize size)
- {
- fHeader.fBits &= ~BestFitBlockHeader_kSizeMask;
- fHeader.fBits |= (size << BestFitBlockHeader_kSizeShift)
- & BestFitBlockHeader_kSizeMask;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetBlockType
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetBlockType(unsigned long blockType)
- {
- fHeader.fBits &= ~BestFitBlockHeader_kBlockTypeMask;
- fHeader.fBits |= (blockType << BestFitBlockHeader_kBlockTypeShift)
- & BestFitBlockHeader_kBlockTypeMask;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetMagicNumber
- //----------------------------------------------------------------------------------------
-
- inline void PrivBestFitBlock::SetMagicNumber(unsigned long magicNumber)
- {
- fHeader.fBits &= ~BestFitBlockHeader_kMagicNumberMask;
- fHeader.fBits |= (magicNumber << BestFitBlockHeader_kMagicNumberShift)
- & BestFitBlockHeader_kMagicNumberMask;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::GetHeap
- //----------------------------------------------------------------------------------------
- inline BestFitHeap* PrivBestFitBlock::GetHeap() const
- {
- MM_ASSERT(this->GetBusy());
- return fHeader.fHeap;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::SetHeap
- //----------------------------------------------------------------------------------------
- inline void PrivBestFitBlock::SetHeap(BestFitHeap *heap)
- {
- MM_ASSERT(this->GetBusy());
- fHeader.fHeap = heap;
- }
-
- //----------------------------------------------------------------------------------------
- // PrivBestFitBlock::PrivBestFitBlock
- //----------------------------------------------------------------------------------------
-
- inline PrivBestFitBlock::PrivBestFitBlock(int busy,
- int previousBusy,
- long size)
- {
- SetParent(NULL);
- SetRight(NULL);
- SetLeft(NULL);
-
- // ***** Setting these 4 bits can be greatly optimized -- slam a constant into fFlags
- SetIsFirst(false); //jpa
- SetIsObject(false); //jpa
- SetBlockType(kBlockTypeId);
- SetMagicNumber(kMagicNumber);
-
- SetBusy(busy);
- SetPrevBusy(previousBusy);
- SetSize(size);
-
- if (!busy)
- this->StuffAddressAtEnd();
- }
-
-
- //========================================================================================
- // CLASS PrivBestFitSegment
- //
- // The BestFitHeap allocates memory from the system in segments. The segments are
- // linked together in a list so that When the heap is destroyed all segments can be
- // freed.
- //
- //========================================================================================
-
- class PrivBestFitSegment
- {
- public:
-
- friend BestFitHeap;
-
- enum
- {
- kSegmentPrefixSize = 12,
- kSegmentSuffixSize = 4,
- kSegmentOverhead = kSegmentPrefixSize + kSegmentSuffixSize
- };
-
- Boolean AddressInSegment(const void* ptr);
- Boolean CheckSegment( HeapWalkProc, void *refCon, ODBlockSize blockHeaderSize );
-
- #if MM_DEBUG
- MMBoolean FindBlockContaining( const void *start, const void *end,
- const void* &blockStart, const void* &blockEnd ) const;
- #endif
-
- private:
- void *fSegmentSpace;
- unsigned long fSegmentSize;
- PrivBestFitSegment *fNextSegment;
-
- PrivBestFitSegment(const PrivBestFitSegment& blk);
- PrivBestFitSegment& operator=(const PrivBestFitSegment& blk);
- // This class shouldn't be copied.
- };
-
- //----------------------------------------------------------------------------------------
- // INLINES PrivBestFitSegment
- //----------------------------------------------------------------------------------------
-
- inline Boolean PrivBestFitSegment::AddressInSegment(const void* ptr)
- {
- return ptr >= fSegmentSpace &&
- ptr <= (void*) ((ODBytePtr) fSegmentSpace + fSegmentSize);
- }
-
-
- //========================================================================================
- // CLASS PrivFreeBlockTree
- //
- // Binary tree for storing free blocks. Dependent on the structure and
- // implementation of PrivBestFitBlock.
- //
- //========================================================================================
-
- class PrivFreeBlockTree
- {
- public:
- PrivFreeBlockTree();
- PrivFreeBlockTree(const PrivFreeBlockTree& blk);
-
- PrivFreeBlockTree& operator=(const PrivFreeBlockTree& blk);
-
- void AddBlock(PrivBestFitBlock* blk);
- void TreeInfo(unsigned long& bytesFree,
- unsigned long& numberOfNodes) const;
- void RemoveBlock(PrivBestFitBlock* blk);
- PrivBestFitBlock* SearchForBlock(ODBlockSize size,
- void* blk,
- PrivBestFitBlock** insertLeaf = NULL);
- const PrivBestFitBlock* FindLargestBlock( ) const;
-
- #if MM_DEBUG
- void CheckTree() const;
- void PrintTree() const;
- #endif
-
- protected:
- PrivBestFitBlock* GetSuccessorBlk(PrivBestFitBlock* blk);
- void TreeInfoHelper(PrivBestFitBlock* blk,
- unsigned long& bytesFree,
- unsigned long& numberOfNodes) const;
-
- #if MM_DEBUG
- void CheckTreeHelper(PrivBestFitBlock* blk) const;
- void PrintTreeHelper(PrivBestFitBlock* blk,
- int level = 0) const;
- #endif
-
- private:
- PrivBestFitBlock fRoot;
-
- };
-
-
- //========================================================================================
- // CLASS BestFitHeap
- //
- // Memory allocation heap using the best fit allocation strategy.
- //
- //========================================================================================
-
- class BestFitHeap : public MemoryHeap
- {
- public:
-
- virtual unsigned long BytesFree() const;
- virtual unsigned long HeapSize() const;
-
- BestFitHeap(unsigned long sizeInitial,
- unsigned long sizeIncrement = 0,
- unsigned long hugeBlockSize = 0, // "0" means sizeIncrement/2
- MMHeapLocation = kMMTempMemory);
- virtual ~BestFitHeap();
-
- void IBestFitHeap();
- void ExpandHeap(unsigned long sizeInitial, unsigned long sizeIncrement);
-
- long GetSizeIncrement( ) {return fSizeIncrement;}
- long GetHugeBlockSize( ) {return fSizeIncrement;}
-
- #if MM_DEBUG
- virtual void Check( HeapWalkProc proc =NULL, void *refCon =NULL ) const;
- virtual Boolean IsMyBlock(const void* blk) const;
- virtual void Print(char* msg = "") const;
- #endif
-
- protected:
-
- void AddToFreeBlocks(PrivBestFitBlock* blk);
- PrivBestFitBlock* Coalesce(PrivBestFitBlock* blk);
- PrivBestFitBlock* CreateNewSegment(unsigned long size); //returns free block --jpa
- void DeleteSegment( PrivBestFitSegment *seg );
- void DeleteSegments();
- void GrowHeap(unsigned long sizeIncrement);
- void RemoveFromFreeBlocks(PrivBestFitBlock* blk);
- PrivBestFitBlock* SearchFreeBlocks(ODBlockSize size);
-
- virtual void* DoAllocate(ODBlockSize size, ODBlockSize& allocatedSize);
- virtual ODBlockSize DoBlockSize(const void* block) const;
- virtual void DoFree(void*);
- virtual void DoReset();
- virtual unsigned long DoLargestFreeBlock() const;
-
- virtual void DoSetBlockIsObject( void* ptr, Boolean isObject );
-
- virtual Boolean DoBlockIsObject( const void* ptr ) const;
-
- virtual MemoryHeap* DoGetBlockHeap( const void* ) const;
-
- #if MM_DEBUG
- virtual void CompilerCheck();
- virtual Boolean DoIsValidBlock(const void* blk) const;
- MMBoolean DoFindBlockContaining( const void *start, const void *end,
- const void* &blockStart, const void* &blockEnd ) const;
- #endif
-
- private:
- PrivBestFitSegment* fSegments;
- unsigned long fSizeIncrement;
- unsigned long fSizeInitial;
- unsigned long fHugeBlockSize; //jpa
- PrivFreeBlockTree fFreeTree;
-
- enum{ kMaxHugeBlockSize = 65535L };
-
- BestFitHeap(const BestFitHeap& blk);
- BestFitHeap& operator=(const BestFitHeap& blk);
- // This class shouldn't be copied.
- };
-
- #endif
-